@extends('admin/layout')

@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">会员管理</a></li>
                <li><a href="#">会员列表</a></li>
                <li class="active"> 会员积分管理</li>
            </ol>

        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12" style="width: 100%;">
                    <div class="box">
                        <div class="box-header with-border">
                            <h3 class="box-title">内容</h3>
                        </div>
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                    <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                </div>
                                @endforeach
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <!-- /.box-header -->
                        <div class="box-body">
                            <form action="{{ url('admin/users/integralEdit') }}" method="post" >
                                {{ csrf_field() }}
                                <table class="table table-bordered" style=" text-align: center;">
                                    <tr>
                                        <th style=" text-align: center;">编号</th>
                                        <th style=" text-align: center;">会员账号</th>
                                        <th style=" text-align: center;">积分</th>
                                        <th style=" text-align: center;">操作</th>
                                    </tr>
                                    <tr>
                                        <td>{{ $list['id'] }}
                                            <input type="hidden" name="id" value="{{ $list['id'] }}">
                                        </td>
                                        <td>{{ $list['name'] }}</td>
                                        <td id="inte">{{ $list['integral'] }}</td>
                                        <td><input type="button" name="add" value="修改" onclick="pius()" class="btn btn-warning btn-xs"></td>

                                        {{--<div id="div" style="width: 300px;border: 1px dashed #CCCCCC;background-color: #FFFFCC; display:none">this is a div!</div>--}}
                                    </tr>
                                </table>
                                <div id="div" style="display:none;width: 200px;margin-left: 900px;">
                                    <input type="radio" name="way" value="1" id="inlineRadio2" style="width:10px;height:10px;">增加
                                    <input type="radio" name="way" value="2" style="width:10px;height:10px;">减少 <br />
                                    <input type="text" name="add" id="123" value="0" style="padding-bottom:2px;height:25px;">
                                    <button type="submit" value="" class="btn btn-primary btn-xs" style="height:25px;">确定</button>
                                </div>
                            </form>

                            <script>
                                var int=document.getElementById('inte').innerHTML;
                                function pius() {
                                    document.getElementById('div').style.display = ""

                                }
                            </script>
                            <p style="text-align: center;font-size: 30px;margin-top: 100px;">操作记录</p>
                            <table  class="table table-bordered" style=" text-align: center;">
                                <tr>
                                    <th style=" text-align: center;">编号</th>
                                    <th style=" text-align: center;">修改时间</th>
                                    <th style=" text-align: center;">操作人</th>
                                    <th style=" text-align: center;">修改数量</th>

                                </tr>

                                    @foreach($record as $r)
                                    <tr>
                                        <td>{{ $r['id'] }}</td>
                                        <td>{{ $r['create_time'] }}</td>
                                        {{--<td>{{ $r['manage_id'] }}</td>--}}
                                        <td>{{ App\Manage::find($r['manage_id'])['username'] }}</td>
                                        <td>
                                            @if( $r['change_way'] == 1 )+{{ $r['change_integral'] }}
                                            @else -{{ $r['change_integral'] }}
                                            @endif

                                        </td>
                                    </tr>
                                    @endforeach
                            </table>
                            <div style="text-align: center;">
                                {{ $record->links() }}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <!-- /.content-wrapper -->
@stop